package com.consumer._01_hello;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

@Component
@RocketMQMessageListener(
        topic = "01-boot-hello",
        consumerGroup = "spring-boot-consumer-demo"
)
public class Consumer implements RocketMQListener<String> {
    /**
     * 当我们监听到topic中有消息的时候，就会执行onMessage的逻辑
     */
    @Override
    public void onMessage(String message) {
        System.out.println("消息内容:" + message);
    }
}